package com.example.demo.repository;

import java.util.List;

import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import com.example.demo.custom.BaseRepository;
import com.example.demo.entity.NewCar1;
import com.example.demo.entity.NewCar2;
@Repository
public interface NewCar2Repository extends BaseRepository<NewCar2, Integer>{

	List<NewCar2> findByNewCar(NewCar1 newCar1);

	/**
	 * @param car
	 * @return 通过时间排序得到最新一条
	 */
	@Query(value = "SELECT  *  FROM new_car2 t WHERE t.new_car_id=? ORDER BY t.xiu_gai_date DESC LIMIT 1 ",nativeQuery=true)
	NewCar2 findByNewCar2(Integer id);

}
